admin: Don't fail to deploy if there isn't a bootloader config
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Tue, 20 Aug 2013 14:28:34 +0000 (14:28 +0000)
committerColin Walters <walters@verbum.org>
Thu, 22 Aug 2013 09:52:16 +0000 (05:52 -0400)
Currently, when deploying an OSTree that does not contain a
bootloader configuration it fails with the following message:

"No known bootloader configuration detected"

A bootloader configuration is not strictly necessary if the
bootloader used is able to parse /boot/loader/entries on boot.

So, failing to deploy seems to be a little harsh. It is better
to just not write the bootloader configuration if a previous
one was not found but still swap the bootversion.

https://bugzilla.gnome.org/show_bug.cgi?id=706477

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
src/ostree/ot-admin-deploy.c

index deda4eb232da995495ec0514b545ade5f5f8f946..d437564c44861ad54bcad655f12812aa04549bcf 100644 (file)
@@ -975,15 +975,7 @@ ot_admin_write_deployments (GFile             *sysroot,
 {
   gboolean ret = FALSE;
   guint i;
-  gs_unref_object OtBootloader *bootloader = NULL;
-
-  bootloader = ot_admin_query_bootloader (sysroot);
-  if (!bootloader)
-    {
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   "No known bootloader configuration detected");
-      goto out;
-    }
+  gs_unref_object OtBootloader *bootloader = ot_admin_query_bootloader (sysroot);
 
   if (current_bootversion == new_bootversion)
     {
@@ -1029,9 +1021,12 @@ ot_admin_write_deployments (GFile             *sysroot,
           goto out;
         }
 
-      if (!ot_bootloader_write_config (bootloader, new_bootversion,
-                                       cancellable, error))
-        goto out;
+      if (bootloader && !ot_bootloader_write_config (bootloader, new_bootversion,
+                                                     cancellable, error))
+          {
+            g_prefix_error (error, "Bootloader write config: ");
+            goto out;
+          }
 
       if (!swap_bootloader (sysroot, current_bootversion, new_bootversion,
                             cancellable, error))